//
//  InpOperatorCell.m
//  掌上宏力
//
//  Created by admin on 2017/5/18.
//  Copyright © 2017年 admin. All rights reserved.
//

#import "InpOperatorCell.h"
#import "InpOperationModel.h"

static CGFloat Lab_H = 30;

@interface InpOperatorCell ()

@property (nonatomic,weak) UILabel *opNameLab;
@property (nonatomic,weak) UILabel *opHealLab;
@property (nonatomic,weak) UILabel *opDateLab;
@property (nonatomic,weak) UILabel *opMethodLab;
@property (nonatomic,weak) UILabel *opOperatorLab;
@property (nonatomic,weak) UILabel *opFirstASSLab;
@property (nonatomic,weak) UILabel *opSecondASSLab;
@property (nonatomic,weak) UILabel *opLastDateLab;

@end

@implementation InpOperatorCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        UILabel *opNameLab = [[UILabel alloc] initWithFrame:CGRectMake(LeftDis, 5, kScreenW-150, Lab_H)];
        [self.contentView addSubview:opNameLab];
        self.opNameLab = opNameLab;
        
        UILabel *opHealLab = [[UILabel alloc] initWithFrame:CGRectMake(LeftDis, opNameLab.bottom, 50, Lab_H)];
        [self.contentView addSubview:opHealLab];
        self.opHealLab = opHealLab;
        
        UILabel *opMethodLab = [[UILabel alloc] initWithFrame:CGRectMake(opHealLab.right, opNameLab.bottom, 100, Lab_H)];
        opMethodLab.font = kFont(15);
        [self.contentView addSubview:opMethodLab];
        self.opMethodLab = opMethodLab;
        
        UILabel *opOperatprLab = [[UILabel alloc] initWithFrame:CGRectMake(LeftDis, opMethodLab.bottom, kScreenW-20, Lab_H)];
        opOperatprLab.font = kFont(15);
        [self.contentView addSubview:opOperatprLab];
        self.opOperatorLab = opOperatprLab;
        
        UILabel *opLastDateLab = [[UILabel alloc] initWithFrame:CGRectMake(LeftDis, opOperatprLab.bottom, kScreenW-20, Lab_H)];
        opLastDateLab.font = kFont(15);
        [self.contentView addSubview:opLastDateLab];
        self.opLastDateLab = opLastDateLab;
        
    }
    return self;
}

-(void)setOpModel:(InpOperationModel *)opModel{
    self.opNameLab.text = opModel.opName;
    self.opHealLab.text = opModel.opHeal;
    self.opMethodLab.text = opModel.opMethod;
    self.opOperatorLab.text = [NSString stringWithFormat:@"参与医生：%@    %@    %@",opModel.opOperator,opModel.opFirstASS,opModel.opSecondASS];
    NSString *dateStr = [NSString stringWithFormat:@"最后一次访问时间：%@",opModel.opLastDate];
    self.opLastDateLab.text = [dateStr substringToIndex:dateStr.length-8];
}

+(instancetype)cellWithTableView:(UITableView *)tableView{
    static NSString *cellId = @"operatorCell";
    InpOperatorCell *cell = [tableView dequeueReusableCellWithIdentifier:cellId];
    if (cell == nil) {
        cell = [[InpOperatorCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
